import 'package:winkai/generated/json/base/json_convert_content.dart';
import 'package:winkai/helper/iap/entity/a_iap_req.dart';

AIAPReq $AIAPReqFromJson(Map<String, dynamic> json) {
  final AIAPReq aIAPReq = AIAPReq();
  final String? deviceId = jsonConvert.convert<String>(json['device_id']);
  if (deviceId != null) {
    aIAPReq.deviceId = deviceId;
  }
  final String? packageName = jsonConvert.convert<String>(json['package_name']);
  if (packageName != null) {
    aIAPReq.packageName = packageName;
  }
  final String? productId = jsonConvert.convert<String>(json['product_id']);
  if (productId != null) {
    aIAPReq.productId = productId;
  }
  final String? receiptBase64Data = jsonConvert.convert<String>(
      json['receipt_base64_data']);
  if (receiptBase64Data != null) {
    aIAPReq.receiptBase64Data = receiptBase64Data;
  }
  return aIAPReq;
}

Map<String, dynamic> $AIAPReqToJson(AIAPReq entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['device_id'] = entity.deviceId;
  data['package_name'] = entity.packageName;
  data['product_id'] = entity.productId;
  data['receipt_base64_data'] = entity.receiptBase64Data;
  return data;
}

extension AIAPReqExtension on AIAPReq {
  AIAPReq copyWith({
    String? deviceId,
    String? packageName,
    String? productId,
    String? receiptBase64Data,
  }) {
    return AIAPReq()
      ..deviceId = deviceId ?? this.deviceId
      ..packageName = packageName ?? this.packageName
      ..productId = productId ?? this.productId
      ..receiptBase64Data = receiptBase64Data ?? this.receiptBase64Data;
  }
}